FROM ubuntu:focal
WORKDIR /code

RUN sed -i "s/archive.ubuntu.com/mirrors.nju.edu.cn/g" /etc/apt/sources.list
RUN sed -i "s/security.ubuntu.com/mirrors.nju.edu.cn/g" /etc/apt/sources.list
RUN apt-get update -y && apt-get install -y python3 && rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && apt-get install -y python3-pip && rm -rf /var/lib/apt/lists/*
RUN apt-get update -y && DEBIAN_FRONTEND="noninteractive" apt-get install -y python3-scrapy && rm -rf /var/lib/apt/lists/*
### maybe need to install python3-twisted
RUN pip install scrapy-redis==0.7.2 -i https://pypi.douban.com/simple
RUN pip install --no-cache-dir pymongo==4.1.1 -i https://pypi.douban.com/simple
COPY . /code/
RUN sleep 5
CMD [ "python3","/code/process_items.py", "dmoz:items", "--host" , "redis","--port","6379",]
#CMD ["tail" ,"-f" ,"/dev/null" ]